import Vue from 'vue'  //引入Vue
import VueRouter from 'vue-router'
import Organic from "@/components/Organic.vue";
import HomeBody from "@/components/OrganicBody/HomeBody.vue";
import LoginBody from "@/components/OrganicBody/LoginBody.vue";
import Product from "@/components/OrganicBody/Product.vue";
import Cart from "@/components/OrganicBody/Cart.vue";
import ErrorBody from "@/components/OrganicBody/404Body.vue"
import UserBody from "@/components/OrganicBody/UserBody.vue";
import CheckoutBody from "@/components/OrganicBody/CheckoutBody.vue";
import MerchantBody from "@/components/OrganicBody/MerchantBody.vue";
import SupplierBody from "@/components/OrganicBody/SupplierBody.vue";
import ShopBody from "@/components/OrganicBody/ShopBody.vue";
import Registered from "@/components/OrganicBody/Registered.vue";
//引入vue-router
// import LoginBody from "@/components/OrganicBody/LoginBody.vue";
import BackEnd from "@/components/BackEnd.vue";
import User from "@/components/BackEnd_body/User.vue";
import MerchantReview from "@/components/BackEnd_body/MerchantRv.vue";
import Merchant from "@/components/BackEnd_body/Merchant.vue";
import SupplierReview from "@/components/BackEnd_body/SupplierRv.vue";
import supplier from "@/components/BackEnd_body/Supplier.vue";
import warehouseReview from "@/components/BackEnd_body/WarehouseRv.vue";
import warehouseList from "@/components/BackEnd_body/WarehouseList.vue";
import warehousing from "@/components/BackEnd_body/warehousing.vue";
import dispatchWarehouse from "@/components/BackEnd_body/DispatchWarehouse.vue";
import PurchaseRequisition from "@/components/BackEnd_body/PurchaseRequisition.vue";
import purchaseReview from "@/components/BackEnd_body/PurchaseRv.vue";
import order from "@/components/BackEnd_body/Order.vue";
import stock from "@/components/BackEnd_body/Stock.vue";
import MerchantAccount from "@/components/BackEnd_body/MerchantAccount.vue";
import SupplierAccount from "@/components/BackEnd_body/SupplierAccount.vue";
import checkOutRv from "@/components/BackEnd_body/CheckOutRv.vue";
import LoginComponent from "@/components/LoginComponent.vue";
import GoodsType from "@/components/BackEnd_body/GoodsType.vue";
import Goods from "@/components/BackEnd_body/Goods.vue";
import AllocateGoods from "@/components/BackEnd_body/AllocateGoods.vue";
import returnProduct from "@/components/BackEnd_body/ReturnProduct.vue"
import orderList from "@/components/BackEnd_body/OrderList.vue";
Vue.use(VueRouter)  //使用vue-router
const routes = [  //创建路由，这里使用了上面引入的组件
    {
        path: '/Organic',
        component: Organic,
        children:[
            {path: 'login' ,component: LoginBody},
            {path: 'registered',component: Registered},
            {path: 'home',component: HomeBody},
            {path: 'product' ,component: Product},
            {path: 'cart',component: Cart},
            {path: '404',component: ErrorBody},
            {path: 'user',component: UserBody},
            {path: 'checkout',component: CheckoutBody},
            {path: 'merchant',component: MerchantBody},
            {path: 'supplier',component: SupplierBody},
            {path: 'shop',component: ShopBody},
            {path: '' ,redirect: 'home'}
        ]
    },
    {
        path: '/backend',
        component: BackEnd,
        children:[
            {path: 'user' ,component: User},
            {path: 'merchantReview' ,component: MerchantReview},
            {path: 'merchant' ,component: Merchant},
            {path: 'supplierReview' ,component: SupplierReview},
            {path: 'supplier' ,component: supplier},
            {path: 'warehouseReview' ,component: warehouseReview},
            {path: 'warehouseList' ,component: warehouseList},
            {path: 'warehousing' ,component: warehousing},
            {path: 'dispatchWarehouse' ,component: dispatchWarehouse},
            {path: 'PurchaseRequisition' ,component: PurchaseRequisition},
            {path: 'purchaseReview' ,component: purchaseReview},
            {path: 'stock' ,component: stock},
            {path: 'order' ,component: order},
            {path: 'orderList' ,component: orderList},
            {path: 'AllocateGoods' ,component: AllocateGoods},
            {path: 'returnProduct' ,component: returnProduct},
            {path: 'MerchantAccount' ,component: MerchantAccount},
            {path: 'SupplierAccount' ,component: SupplierAccount},
            {path: 'checkOutRv' ,component: checkOutRv},
            {path: 'GoodsType' ,component: GoodsType},
            {path: 'Goods' ,component: Goods},
            {path: '' ,redirect: 'user'} // 修改默认重定向路径
        ]
    },
    {path: '/login',component: LoginComponent},
    {path: '/',redirect: '/Organic'}
]
const router = new VueRouter({
    routes,
    mode: 'history' //使URL不带#
})
export default router  //导出路由
